//
//  LFConst.h
//  sybx_ios
//
//  Created by 如沐春风 on 2020/9/25.
//  Copyright © 2020 mars. All rights reserved.
//

#ifndef LFConst_h
#define LFConst_h



#define kBASEServerURL @"https://fxyy.huimaibuy.com/public/"
#define kBASEURL @"https://fxyy.huimaibuy.com/public/home/Api/"



#pragma mark - 定义GGLog
#ifdef DEBUG // 开发阶段
#define WALog(...) NSLog(@"文件:%s 函数%s 第%d行 \n %@\n\n",__FILE__,__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])

#else // 发布阶段
#define WALog(...)
#endif


//常用
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
#define NAV_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height + self.navigationController.navigationBar.frame.size.height
#define StatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define TAB_HEIGHT ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)

#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
//颜色 Color
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
#define MainColor RGB(131,193,32)
#define kColorTableBG RGB(250,250,250)
#define NORMAL_BGCOLOR RGB(248, 248, 248)
//部分字体颜色
#define RGB46  RGB(46, 46, 46)
#define RGB55  RGB(55, 55, 55)
#define RGB135 RGB(135, 135, 135)
#define RGB211 RGB(211, 211, 211)
#define NORMAL_RED RGB(238,22,22)
//DeBugLog
#define MYLog(s, ...) NSLog(@"%s(%d): %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])

//空判断相关
#define isEmptyStr(str) (!str||[str isKindOfClass:[NSNull class]]||[str isEqualToString:@""]) //判断是否空字符串
#define isEmptyArr(arr) (!arr||((NSArray *)arr).count==0) //判断是否空数组
#define isNull(str)     (!str||[str isKindOfClass:[NSNull class]])
#define FONTFIT(F) [MyAdapter laDapter:F]
#define SIZEFIT(S)  [MyAdapter laDapter:S]
#define SIZE(S)  [MyAdapter laDapter:S]
#define FONT(S)  [MyAdapter lfontADapter:S]

// 判断是否为iPhone X 系列
#define IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#define kSafeAreaTopHeight (IPHONE_X ? 88 : 64)
#define kSafeAreaTabbarHeight (IPHONE_X ? 83 : 49)

//是否是iPhoneX
#define kDevice_Is_iPhoneX (@available(iOS 11.0, *) ? ([UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom ? YES : NO) : NO)
//导航条的高度
#define NavigationHeight    (kDevice_Is_iPhoneX ? 88 :  64)

#define SafeAreaBottomHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom : 0)
#define SafeAreaTopHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.top : 0)
#define SafeAreaLeftHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.left : 0)
#define SafeAreaRightHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaIn
//TabBar Nav  高度
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define kNavBarHeight 44.0
#define kTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
#define kTopHeight (kStatusBarHeight + kNavBarHeight)
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define kSafeAreaHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?34:0)

#define kInfoCenterHeight SIZE(150)//SIZE(160) //(SCREEN_HEIGHT-kTopHeight-SIZE(409)-kSafeAreaTabbarHeight+49-SIZE(20)+HEIGHT_5_SE-kSafeAreaHeight)

//弱引用
#define ws(weakSelf)  __weak __typeof(&*self)weakSelf = self;
//强引用
#define StrongSelf(type)  __strong typeof(type) type     = weak##type;

#define kWindow       [UIApplication sharedApplication].keyWindow
#define kUserDefault  [NSUserDefaults standardUserDefaults]


#pragma mark -- 角度和弧度之间的转换
#define DegreesToRadian(x)        (M_PI * (x) / 180.0)
#define RadianToDegrees(radian)   (radian*180.0)/(M_PI)
#pragma mark -- 获取图片资源
#define GetImage(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

#pragma mark -- 为空的判断
//字符串是否为空
#define isEmptyStr(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
//数组是否为空
#define isEmptyArr(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
//字典是否为空
#define isEmptyDict(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
//是否是空对象
#define isEmptyObject(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))
#define isNull(str)     (!str||[str isKindOfClass:[NSNull class]])


#pragma mark --  获取路径
//获取沙盒Document路径
#define DocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
//获取沙盒temp路径
#define TempPath NSTemporaryDirectory()
//获取沙盒Cache路径
#define CachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]



// 消息通知
#define kRegisterNotify(_name, _selector)                    \
[[NSNotificationCenter defaultCenter] addObserver:self  \
selector:_selector name:_name object:nil];

#define kRemoveNofify            \
[[NSNotificationCenter defaultCenter] removeObserver:self];

#define kSendNotify(_name, _object)  \
[[NSNotificationCenter defaultCenter] postNotificationName:_name object:_object];




#define FONT(S)  [MyAdapter lfontADapter:S]
#define BOLOD(S) [UIFont boldSystemFontOfSize:S]


# define IS_IPHONE5  ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

#define HEIGHT_5_SE  0


#define kCurZHHans ([((NSString *)[[NSLocale preferredLanguages] firstObject]) containsString:@"zh-Hans"])


#define kDelimiter @"<&&>"



#define LFLocalizedString(s) [LocalLanguage LocalizedString:s]

#endif /* LFConst_h */
